<?php
  class Plugins_Price extends model {
  
  
  
  function getformadd($productid="")
  {
   // $echo=1;
 // $properties=array('class'=>'inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2','placeholder'=>'Price');
//  $textbox2=new Element_Textbox("", "price[]",$properties);
//  $strprice=$textbox2->render($echo);
  $strprice='<input type="text" name="price[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2" placeholder="Price" >';
  
//  $properties=array('class'=>'inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2','placeholder'=>'Sale Price');
//  $textbox2=new Element_Textbox("", "saleprice[]",$properties);
//  $strsaleprice=$textbox2->render($echo);


  $strsaleprice='<input type="text" name="saleprice[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2" placeholder="Sale Price" >';
  
  
  $arraycurrency=$this->getcurrency();
  //$option=array();
//  
//  $option['0']="Please select Currency";
//  if(count($arraycurrency))
//  foreach($arraycurrency as $keycountry=> $valuecountry)
//  $option[$keycountry]=$valuecountry;
  
//  $selectbox4=new Element_Select("", "curid[]",$option);
//  $strbox=$selectbox4->render($echo);
  
   $strbox='<select name="curid[]">';
   $strbox.="<option value=\"0\">Please select Currency</option>";
   
     if(count($arraycurrency))
     foreach($arraycurrency as $keycountry=> $valuecountry)
     $strbox.="<option value=\"$keycountry\">$valuecountry</option>";
   
   
   $strbox.="</select>";
   
    $str='           <fieldset class="ShpPlg">
                        <div class="prcPlg fs04 clTxt2">
                            <label>Price</label><br>
                            <div class="wrpInpShpPlg clearfix">
                                '.$strprice.'
                                
                                '.$strsaleprice.'
                                
                                <div class="reDesign reDsShp">
                                '.$strbox.'
                                </div>
                            </div>
                        </div>
                    </fieldset>';
   
  $arraydata['form']=addslashes(str_replace(array("\r", "", "\r"), '', $str));
  //$arraydata['js']=pluginjsinfo.'/price.js';

  
  
      
  
  
  
  return $arraydata;
  
  
  
  
  
  
  
  }
  
  function getformlanding($arraydata)
  {
        
   if($arraydata['price']!="0.00")
        {
        $code = '<div class="ldIt wrpOutPrcLd" style="display: block;">';
        $code .= '    <div class="wrpPrcLd">';
        $code .= '        <h2 class="clTxt2 fs04">Price</h2>';
        if($arraydata['price']&&$arraydata['saleprice']!='0.00')
        {
        $code .= '        <span class="prcLd rgPrc">'.$arraydata['price'].' '.$arraydata['currencyname'].'</span> ';
        }else if($arraydata['price']&&$arraydata['saleprice']=='0.00')
        {
        
        $code .= '        <span class="prcLd">'.$arraydata['price'].' '.$arraydata['currencyname'].'</span> ';
        
        }
        if($arraydata['saleprice']!='0.00')
        {
        $code .= '        <span class="prcLd sPrc">'.$arraydata['saleprice'].' '.$arraydata['currencyname'].'</span>';
        }
        
        
        $code .= '        <button class="btnGen btnOrdLd clTxtW cutTxt clBgBt1 fs04">Order</button>';
        $code .= '    </div>';
        $code .= '</div>';
        }else
        {
        $code="";
        }
        $data['str']=$code;
        $data['target']='firsttarget';
  
  return $data;
  
  
  }
  
  function getplugin($plugreid)
  {
  
     $sql="select * from tb_plugins_price where plugreid=".$plugreid;
     $arrayplugin=$this->db->db_set_1recordrow($sql);
     
     
     if($arrayplugin['curid'])
     {
     $arrayplugin['currencyname'] =$this->getcurrencybycurid($arrayplugin['curid']);
     }else
     {
     $arrayplugin['currencyname']=""; 
     }
     
     if($arrayplugin['saleprice']!='0.00')
     {
     $arrayplugin['show']=$arrayplugin['saleprice'].' '.$arrayplugin['currencyname'];
     }else if($arrayplugin['price'])
     {
     $arrayplugin['show']=$arrayplugin['price'].' '.$arrayplugin['currencyname'];
     }else
     {
     $arrayplugin['show']="";
     
     }
     
    
     
  
     return $arrayplugin;
  

  
  
  

  
  }
  
  function saveplugin($arraydata,$productid,$plugreid)
  {
  
  $arraydata['productid']=$productid;
  $arraydata['plugreid']=$plugreid;
  $this->db->db_set($arraydata,'tb_plugins_price');
  
  
  }
  
  
  }
?>
